import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AmountRecordVO, AmountRecordForm, AmountRecordQuery } from '@/api/project/amountRecord/types';

/**
 * 查询PM金额记录列表
 * @param query
 * @returns {*}
 */

export const listAmountRecord = (query?: AmountRecordQuery): AxiosPromise<AmountRecordVO[]> => {
  return request({
    url: '/project/amountRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询PM金额记录详细
 * @param id
 */
export const getAmountRecord = (id: string | number): AxiosPromise<AmountRecordVO> => {
  return request({
    url: '/project/amountRecord/' + id,
    method: 'get'
  });
};

/**
 * 新增PM金额记录
 * @param data
 */
export const addAmountRecord = (data: AmountRecordForm) => {
  return request({
    url: '/project/amountRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改PM金额记录
 * @param data
 */
export const updateAmountRecord = (data: AmountRecordForm) => {
  return request({
    url: '/project/amountRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除PM金额记录
 * @param id
 */
export const delAmountRecord = (id: string | number | Array<string | number>) => {
  return request({
    url: '/project/amountRecord/' + id,
    method: 'delete'
  });
};
